package org.hxyjs.dao.impl;

import org.hxyjs.dao.GamerecordDao;
import org.hxyjs.entity.Gamerecord;
import org.hxyjs.mapper.GamerecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("gamerecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class GamerecordDaoImpl implements GamerecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private GamerecordMapper gamerecordMapper;
    public List<Gamerecord>  getAllGamerecords() throws Exception{
        return gamerecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteGamerecordByGrno(String grno)  throws Exception{
        return gamerecordMapper.deleteByPrimaryKey(grno);
    }

    @Override
    public Integer updateGamerecordByGrno(Gamerecord gamerecord)  throws Exception{
        return gamerecordMapper.updateByPrimaryKey(gamerecord);
    }

    @Override
    public Integer addGamerecord(Gamerecord gamerecord)  throws Exception{
        return gamerecordMapper.insertSelective(gamerecord);
    }

}
